// tofwov1.cxx -- just store some commands

#include <iostream>
#include <TFile.h>
#include <TTree.h>
#include <TH2F.h>
#include <TCanvas.h>
#include <TClonesArray.h>

// #include "ETFPlaHit.h"
// #include "ETFTrack.h"

using std::cout;
using std::endl;
using std::flush;

#define DEC2023

#ifdef DEC2023
//-- for dec_2023 exp --//
static const double tof2_ofst = 188.9; // ns
static const int ID[2] = {6, 7};
#else
//-- for jul_2018 exp --//
static const double tof2_ofst = 90.7; // ns
static const int ID[2] = {23, 24};
#endif

void tofwov1(){
  // TFile *f = new TFile("tofw.root", "UPDATE");
  TFile *f = new TFile(getenv("TMP1"), "UPDATE");
  TTree *etf = (TTree *)f->Get("etf");
  const int n = etf->GetEntriesFast();
  cout << "Totally " << n << " events" << endl;

  etf->Draw("tofwB.stripId()>>hstripId(17, -1.5, 15.5)");
  etf->Draw("mu1:mu0>>h2mu(2000, 0., 3.5, 2000, 0., 3.5)", "", "col");
  etf->Draw("mu1:pid.aoz()>>hpid(1000, 1.5, 2.5, 1000, 1.4, 1.8)", "kr78", "col");
  etf->Draw("pid.tof2():tofwB.stripId()>>(17, -1.5, 15.5, 500, 55., 65.)", "Length$(postMagTrackerX)==1 && Length$(tofwB)==1", "col");
  etf->Draw("pid.tof2():postMagTrackerX.GetHitPos(\"tofwB\")>>(1000, -700., 700., 500, 55., 65.)", "Length$(postMagTrackerX)==1 && Length$(tofwB)==1", "col");
  etf->Draw("pid.tof2():postMagTrackerX.GetHitPos(\"tofwB\")>>(1000, -700., 700., 500, 10., 200.)", "Length$(postMagTrackerX)==1 && Length$(tofwB)==1", "col");
} // end main function
